home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
boe.pres.k12.wv.us
/
boe.pres.k12.wv.us.zip
/
boe.pres.k12.wv.us
/
Utilities
/
Xerox Workcentre 5335
/
Windows Scan
/
64-bit_x64
/
Japanese
/
cpsimage.cab
/
data
/
pdf
/
img2pdf.elf
< prev
next >
Wrap
Text File
|
2009-03-16
|
2KB
|
62 lines
// The TimeCheck() function reports the time to this point in the execution
print "time to start interpreter = " + TimeCheck() + "secs";
// Get definitions and support procedures
#import "documentio.ucm";
#import "fiji2xip.ucm";
#import "fwx2xip.ucm";
#load "xipProcs/printLayer.proc";
#load "xipProcs/getOcrPage.proc";
// Load image functions and methods
LoadClasses ( filename: "xeng" );
IMPORT STRING infile;
IMPORT STRING language = "English";
IMPORT INTEGER ocr = 1; // Default is on
XIPIMAGE img;
STRING ocrformat = "XDOC";
STRING ocrxdoc, ocrxml;
// Test for proper parameters
if ( !infile) {
print "Usage: \"xipe img2pdf.elf -im infile:s language:s ocr:i 0|1\" ";
end;
}
// Set output filename
STRING outpdf = infile.name() + ".pdf";
if (infile.ext() == "jpg") {
img = readjpg (filename: infile, compressed:TRUE, rawcolor: TRUE);
} else {
img = readimage (filename: infile);
}
print "FIJI Segmentation ...";
XIPIMAGE ims = img.fijiSeg (cfgfile: "$XIPTOP/data/fiji/fijiNlc.cfg");
print "Segmented image has " + ims.nlayers + " layers";
if ( ocr ) {
print "OCR ...";
XIPIMAGE ocrimg = getOcrPage (input:ims, language: language);
ocrimg.setMember(member:"visibility", value: FALSE);
ims.addLayer(image:ocrimg, ltype: XIP_Text);
}
// Make a DOCUMENTWRITER
print "creating PDF writer";
DOCUMENTWRITER docwrite = CreateDocumentWriter (filename:outpdf);
// Add page to the DOCUMENT
docwrite.appendPage (pgImg: ims);
docwrite.release();
// How long has this taken
print TimeCheck();
print "output pdf file = " + outpdf;